From: Brion Vibber Date: Mon, 18 May 2009 18:52:53 +0000 (+0000) Subject: Revert r50721 "(bug 18834) Commit Patch from User Joshua C. Lerner for include/Linker.php" * Fails to explain purpose of patch * use of SQL variable interpolation without using standard encoded variable naming convention; looks unsafe and makes review harder * Code has issues already noted; follow-up code was also reverted. Code needs a little more cooking I think. :) --- diff --git a/includes/Linker.php b/includes/Linker.php index e93598e1b5..f3fdb549b3 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1621,56 +1621,7 @@ class Linker { } $query['token'] = $wgUser->editToken( array( $title->getPrefixedText(), $rev->getUserText() ) ); - - $dbr = wfGetDB( DB_MASTER ); - - // Latest edits by this user, up to 10; if too expensive, use only on smaller wikis - $res = $dbr->select( 'revision', - array( 'rev_id' ), - array( 'rev_page' => $rev->getPage(), - 'rev_user_text' => $rev->getUserText() - ), __METHOD__, - array( 'USE INDEX' => 'page_timestamp', - 'ORDER BY' => 'rev_timestamp DESC', - 'LIMIT' => 10 ) - ); - - // Swiped from Article::commitRollback() - $user = intval( $rev->getUser() ); - $user_text = $dbr->addQuotes( $rev->getUserText() ); - - // Get the last edit not by this guy - $s = $dbr->selectRow( 'revision', - array( 'rev_id', 'rev_timestamp', 'rev_deleted' ), - array( 'rev_page' => $rev->getPage(), - "rev_user != {$user} OR rev_user_text != {$user_text}" - ), __METHOD__, - array( 'USE INDEX' => 'page_timestamp', - 'ORDER BY' => 'rev_timestamp DESC' ) - ); - - if( $s === false ) { - // No one else ever edited this page - return false; - } - elseif( $s->rev_deleted & REVISION::DELETED_TEXT || $s->rev_deleted & REVISION::DELETED_USER ) { - // Only admins can see this text - return false; - } - - $editCount = 0; - while( $row = $dbr->fetchObject( $res ) ) { - $editCount++; - if( $s->rev_id > $row->rev_id ) { - break; - } - } - - // We only bother to count up to 10 - if( $editCount == 10 ) - $editCount = '10+'; - - return $this->link( $title, wfMsgHtml( 'rollbacklink', $editCount ), + return $this->link( $title, wfMsgHtml( 'rollbacklink' ), array( 'title' => wfMsg( 'tooltip-rollback' ) ), $query, array( 'known', 'noclasses' ) ); }